<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="vue.js"></script>
<script type="text/javascript" src="axios.min.js"></script>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
	<div id="itany">
		<a>{{data.userName}}</a>
		<button v-on:click="send">getOne</button>
<!-- 		<button v-on:click="sendList">list</button> -->
		<table>
		 <tr v-for="value in userList">
                <td>{{value.userName}}</td>
                <td>{{value.userId}}</td>
            </tr>
	</table>
	</div>
	<script type="text/javascript">
	new Vue({
		el : '#itany',
		data :{data :{userName:"ddd"},userList:""},
		methods : {
			send : function() {
				 axios.get('http://172.20.8.98:8001/user/get/1',{
	                    params:{
	                    }
	                })
	                .then(resp => {
	                    console.log(resp.data);
					this.data=resp.data;
	                }).catch(err => {             //
	                    console.log('请求失败：'+err.status+','+err.statusText);
	                });

			}
		},
		created: function () { //created方法，页面初始调用 
			if(isNull(localStorage.pageUrl)){
				localStorage.pageUrl="http://172.20.8.98:8001";
			}
            var url = "http://172.20.8.98:8001/list";
            axios.get(url,{
                params:{
                }
            })
            .then(resp => {
                console.log(resp.data);
			this.userList=resp.data;
			alert(userList.length);
            }).catch(err => {             //
                console.log('请求失败：'+err.status+','+err.statusText);
            });
        }
	});
</script>
</body>
</html>